<html>
    <head>
        <title> /!\ Welcome to MegaSoft ERP SYSTEM </title>
		<meta name="layout" content="main" />
    </head>
    <body>
        <h1 style="margin-left:20px;">${Inter.printOut('Search',session.language)}</h1>
        <p style="margin-left:20px;">${Inter.printOut('searchtext',session.language)}
        </p>
        <div class="dialog" style="margin-left:20px;width:60%;">
          <div class="box" style="width:350px;">
          <form action="/MegaSoft/search/show">
            <h2 style="margin-bottom:10px;">${Inter.printOut('Search Criteria',session.language)}:</h2>
            <g:if test="${!session?.access?.hasAdminAuth()}">
                <g:radioGroup name="searchCriteria" value="name" labels="[(Inter.printOut('Project or Course Name',session.language)),(Inter.printOut('Project or Course Id',session.language))]" values="['name','activityId']" >
                <p>${it.radio} ${it.label}</p>
                </g:radioGroup>
            </g:if>
            <g:else>
              <g:radioGroup name="searchCriteria" value="name" labels="[(Inter.printOut('Course area',session.language)),(Inter.printOut('Project or Course Name',session.language)),(Inter.printOut('Project or Course Id',session.language))]" values="['area','name','activityId']" >
              <p>${it.radio} ${it.label}</p>
              </g:radioGroup>
            </g:else>
            <p><br />
            <input type="text" name="keyword" id="keyword" value="" />
            <input type="submit" value ="${Inter.printOut('Search',session.language)}" action="Search" />
            </p>
          </form>
          </div>
          <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
          </g:if>
          <g:if test="${courseList && session?.container && Container.get(session?.container)?.hasTab('Course') && ! (session?.access?.role?.description?.equalsIgnoreCase('Lab Leader'))}">
            <h2>Courses (${courseList.size()} results)</h2>
            <ul>
              <g:each var="m" in="${courseList}">
                <li><g:link controller="course" action="show" id="${m?.id}">${m?.name}</g:link></li>
              </g:each>
            </ul>
          </g:if>
          <g:if test="${projectList && session?.container && Container.get(session?.container)?.hasTab('Project') && ! (session?.access?.role?.description?.equalsIgnoreCase('Director Of Study'))}">
            <h2>Projects (${projectList.size()} results)</h2>
            <ul>
              <g:each var="m" in="${projectList}">
                <li><g:link controller="project" action="show" id="${m?.id}">${m?.name}</g:link></li>
              </g:each>
            </ul>
          </g:if>
          <g:if test="${areaList && session?.container && session?.access?.hasAdminAuth()}">
            <h2>Areas (${areaList.size()} results)</h2>
            <ul>
              <g:each var="m" in="${areaList}">
                <li><g:link controller="area" action="show" id="${m?.id}">${m?.name}</g:link></li>
              </g:each>
            </ul>
          </g:if>
          <!-- This line below is to avoid displaying the old flash message when navigating to another page right after this one. -->
          ${flash.message = ""}
        </div>
    </body>
</html>
